from django.db import models


class Area(models.Model):
    name = models.CharField(verbose_name="区域", max_length=20)
    # SET_NULL主表删除，副表为空
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, verbose_name="父类区域", null=True, blank=True)

    class Meta:
        db_table = 'tb_areas'

    def __str__(self):
        return self.name
# Create your models here.
